package cn.iocoder.yudao.module.system.controller.admin.notice;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeDO;
import cn.iocoder.yudao.module.system.service.notice.NoticeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "APP - 通知公告")
@RestController
@RequestMapping("/app/notice")
@Validated
public class AppNoticeController {

    @Resource
    private NoticeService noticeService;


    @GetMapping("/list")
    @Operation(summary = "获取通知公告列表")
    @PermitAll
    public CommonResult<List<NoticeDO>> getNoticeList(@Validated NoticeRespVO noticeRespVO) {
        return success(noticeService.getNoticeList(noticeRespVO));
    }


    @GetMapping("/shortList")
    @Operation(summary = "获取通知公告列表")
    @PermitAll
    public CommonResult<List<String>> getNoticeShortList() {
        return success(noticeService.getNoticeShortList());
    }


}
